************* NOTE: pause Dropbox synching before running!
	/* right-click Dropbox icon, left-click bottom left of the window */

	
	
*****************
* Macro factors *
*****************

* Import monthly data from Excel to Stata and set time
	foreach x in macro_forecasting_factors_updated ///
	{
		clear all
		import excel "orig/ludvigson/`x'.xlsx", sheet("final_series") firstrow
		destring year month, replace
		gen time = ym(year, month) 
		format time %tm
		drop date
		save "data/`x'.dta", replace
	}

* Take annual averages
	clear all
	use "data/macro_forecasting_factors_updated.dta"
	// take average by year
		foreach x in F1 F2 F3 F4 F5 F6 F7 F8 ///
		{
			egen `x'_y = mean(`x'), by (year)
		}
	// collapse by year
		collapse *_y, by(year)
		foreach x in F1 F2 F3 F4 F5 F6 F7 F8 ///
		{
			rename `x'_y `x'
		}
	save "data/macro_forecasting_factors_updated_annual.dta", replace
